package com.me.Screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.input.GestureDetector.GestureListener;
import com.badlogic.gdx.input.GestureDetector;
import com.me.GameWorld.GameRenderer;
import com.me.GameWorld.GameWorld;
import com.me.Helpers.InputHandler;

public class GameScreen implements Screen{
	
	private GameWorld world;
	private GameRenderer renderer;
	private float runTime;
	
	public GameScreen() {
		// TODO 
		float screenWidth = Gdx.graphics.getWidth();
        float screenHeight = Gdx.graphics.getHeight();      
//        float gameWidth = 136;
//        float gameHeight = screenHeight / (screenWidth / gameWidth);
        
      float gameWidth = screenWidth;
      float gameHeight =    screenHeight;
        
        world = new GameWorld();
        renderer = new GameRenderer(world,(int)gameHeight,(int)gameWidth);
        
        
        InputMultiplexer im = new InputMultiplexer();
        GestureDetector gd = new GestureDetector(new InputHandler(world,renderer));
        im.addProcessor(gd);
        im.addProcessor(new InputHandler(world,renderer));
        
        
        Gdx.input.setInputProcessor(im);
        
	}

	@Override
	public void render(float delta) {
		//TODO
		runTime += delta;
		world.update(delta);
        renderer.render(runTime);
	}
	
	@Override
	public void resize(int width, int height) {
		System.out.println("GameScreen - resizing");
	}

	@Override
	public void show() {
		System.out.println("GameScreen - show called");
	}

	@Override
	public void hide() {
		System.out.println("GameScreen - hide called");
	}

	@Override
	public void pause() {
		System.out.println("GameScreen - pause called");
	}

	@Override
	public void resume() {
		System.out.println("GameScreen - resume called");
	}

	@Override
	public void dispose() {
		// Leave blank
	}
	
}
